/**
 * @Author:  renyc
 * @Date: 2022年12月1日15:34:25
 */

'use strict';
import Event from "./Event";
import MouseEvent from "./MouseEvent";
import {LayerEventType, OverlayEventType, SourceEventType} from "./EventType";
import Viewer from "../viewer/Viewer";


class EventFactory{

    /**
     * 初始化LayerEvent对象
     * @returns {XEarth.Event}对象
     */
    static createLayerEvent(){
        let event = new Event();
        Object.keys(LayerEventType).forEach(key=>{
            let type = LayerEventType[key];
            event.register(type);
        })
        return event;
    }

    /**
     * 初始化LayerEvent对象
     * @returns {XEarth.Event}对象
     */
    static createOverlayEvent(){
        let event = new Event();
        Object.keys(OverlayEventType).forEach(key=>{
            let type = OverlayEventType[key];
            event.register(type);
        })
        return event;
    }

    /**
     * 初始化鼠标事件
     * @param {*} viewer 
     * @returns {XEarth.Event}对象
     */
    static createMouseEvent(viewer){
        let event = new MouseEvent(viewer);
        return event;
    }

    /**
     * 初始化Source事件
     * @Date 2023年2月22日10:56:54
     * @returns {XEarth.Event}对象
     */
    static createSourceEvent(){
        let event = new Event();
        Object.keys(SourceEventType).forEach(key=>{
            let type = SourceEventType[key];
            event.register(type);
        })
        return event;
    }
}

export default EventFactory;
